package com.yss.ams.demo.service;

import com.yss.ams.demo.config.DataSource;
import com.yss.ams.demo.config.DataSourceNames;
import com.yss.ams.demo.mapper.MessageboardMapper;
import com.yss.ams.demo.pojo.Messageboard;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author shenyao
 * @date 2021/3/28
 * @description:
 */
@Service
public class DataSourceTestService {
    @Autowired
    private MessageboardMapper messageboardMapper;

    public Messageboard testMaster(Integer userId){
        return messageboardMapper.selectByPrimaryKey(userId);
    }

    @DataSource(DataSourceNames.TWO)
    public Messageboard testCluster(Integer userId){
        return messageboardMapper.selectByPrimaryKey(userId);
    }
}
